package org.seefly.iprint.entity;

import lombok.Data;

import java.util.Date;

@Data
public class Admin {
    private Integer id;

    private String account;

    private String password;

    private String salt;

    private Date lastLoginTime;

    private Date loginTime; 

    private String lastLoginIp;

    private String loginIp;

    private Integer loginCount;

    public void setLoginIp(String loginIp) {
        this.lastLoginIp = this.loginIp;
        this.loginIp = loginIp == null ? null : loginIp.trim();
        
    }

    /**
     * 更新登陆次数
     */
    public void increaseLoginCount() {
        this.loginCount++;
    }

    /**
     * (更新登陆时间)
     */
    public void updateLoginTime() {
         this.lastLoginTime = this.loginTime;
         this.loginTime = new Date();
    }
}